package com.service.impl;

import com.bean.dangBean.Employee;
import com.bean.dangBean.Role;
import com.dao.dangDao.EmployeeMapper;
import com.dao.dangDao.RoleMapper;
import com.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 用户业务逻辑实现
 */
@Service("employeeService")
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    private EmployeeMapper employeeMapper;
    @Autowired
    private RoleMapper roleMapper;

    @Override
    public int save(Employee employee) {
        return employeeMapper.insert(employee);
    }

    @Override
    public int remove(Employee employee) {
        return employeeMapper.delete(employee);
    }

    @Override
    public int modify(Employee employee) {
        return employeeMapper.update(employee);
    }

    @Override
    public List<Employee> find(Employee employee){return employeeMapper.select(employee);}

    @Override
    public List<Role> queryRole() {
        return roleMapper.select(new Role());
    }

    @Override
    public int count(Map<String, Object> map) {
        return employeeMapper.selectCount(map);
    }

    @Override
    public List<Employee> query(Map<String, Object> map) {
        return employeeMapper.selectByPage(map);
    }
}
